package com.example.agricultural_big_data.util;

import org.springframework.stereotype.Component;

import javax.swing.*;
import java.util.Random;

/**
 * @author xiao yang
 * @Description: 验证码生成工具
 * @date 2021/3/920:27
 */
public class RandomNumUtil {

    public  String getRandNum(){
        String str="ABCDEFGHIGKLMNOPQRSTUVWXYZ0123456789";
        Random r=new Random();
        String arr[]=new String[4];
        String num="";
        for(int i=0;i<4;i++)
        {
            int n=r.nextInt(36);
            arr[i]=str.substring(n,n+1);
            num+=arr[i];
        }
        return num;
    }

}
